<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Jetson Inference: Image I/O</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="NVLogo_2D.jpg"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Jetson Inference
   </div>
   <div id="projectbrief">DNN Vision Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__image.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Image I/O<div class="ingroups"><a class="el" href="group__util.html">Utilities Library (jetson-utils)</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>Loading and saving image files from disk.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classimageLoader.html">imageLoader</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Load an image or set of images from disk into GPU memory.  <a href="classimageLoader.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classimageWriter.html">imageWriter</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Save an image or set of images to disk.  <a href="classimageWriter.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga27eecc15662ad22366515de5cc054342"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:ga27eecc15662ad22366515de5cc054342"><td class="memTemplItemLeft" align="right" valign="top">bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__image.html#ga27eecc15662ad22366515de5cc054342">loadImage</a> (const char *filename, T **ptr, int *width, int *height)</td></tr>
<tr class="memdesc:ga27eecc15662ad22366515de5cc054342"><td class="mdescLeft">&#160;</td><td class="mdescRight">Load a color image from disk into CUDA memory, in uchar3/uchar4/float3/float4 formats with pixel values 0-255.  <a href="#ga27eecc15662ad22366515de5cc054342">More...</a><br /></td></tr>
<tr class="separator:ga27eecc15662ad22366515de5cc054342"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga177a5b87ec9b79bfed324fcab2d3b8c1"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__image.html#ga177a5b87ec9b79bfed324fcab2d3b8c1">loadImage</a> (const char *filename, void **output, int *width, int *height, <a class="el" href="group__imageFormat.html#ga931c48e08f361637d093355d64583406">imageFormat</a> format)</td></tr>
<tr class="memdesc:ga177a5b87ec9b79bfed324fcab2d3b8c1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Load a color image from disk into CUDA memory, in uchar3/uchar4/float3/float4 formats with pixel values 0-255.  <a href="#ga177a5b87ec9b79bfed324fcab2d3b8c1">More...</a><br /></td></tr>
<tr class="separator:ga177a5b87ec9b79bfed324fcab2d3b8c1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad9ee4cb1bfdf4efe01e2971b93118972"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__image.html#gad9ee4cb1bfdf4efe01e2971b93118972">loadImageRGBA</a> (const char *filename, float4 **ptr, int *width, int *height)</td></tr>
<tr class="memdesc:gad9ee4cb1bfdf4efe01e2971b93118972"><td class="mdescLeft">&#160;</td><td class="mdescRight">Load a color image from disk into CUDA memory with alpha, in float4 RGBA format with pixel values 0-255.  <a href="#gad9ee4cb1bfdf4efe01e2971b93118972">More...</a><br /></td></tr>
<tr class="separator:gad9ee4cb1bfdf4efe01e2971b93118972"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac4fec7924987c98f8fbb40176e450e04"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__image.html#gac4fec7924987c98f8fbb40176e450e04">loadImageRGBA</a> (const char *filename, float4 **cpu, float4 **gpu, int *width, int *height)</td></tr>
<tr class="memdesc:gac4fec7924987c98f8fbb40176e450e04"><td class="mdescLeft">&#160;</td><td class="mdescRight">Load a color image from disk into CUDA memory with alpha, in float4 RGBA format with pixel values 0-255.  <a href="#gac4fec7924987c98f8fbb40176e450e04">More...</a><br /></td></tr>
<tr class="separator:gac4fec7924987c98f8fbb40176e450e04"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga54f40bb94c9d78d639a20e5ac1e21669"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:ga54f40bb94c9d78d639a20e5ac1e21669"><td class="memTemplItemLeft" align="right" valign="top">bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__image.html#ga54f40bb94c9d78d639a20e5ac1e21669">saveImage</a> (const char *filename, T *ptr, int width, int height, int quality=95, const float2 &amp;pixel_range=<a class="el" href="cudaMath_8h.html#a931119b28bbeb119817cd0128f422a08">make_float2</a>(0, 255))</td></tr>
<tr class="memdesc:ga54f40bb94c9d78d639a20e5ac1e21669"><td class="mdescLeft">&#160;</td><td class="mdescRight">Save an image in CPU/GPU shared memory to disk.  <a href="#ga54f40bb94c9d78d639a20e5ac1e21669">More...</a><br /></td></tr>
<tr class="separator:ga54f40bb94c9d78d639a20e5ac1e21669"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gadf4b35ed3583dbc77f2444f207de6008"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__image.html#gadf4b35ed3583dbc77f2444f207de6008">saveImage</a> (const char *filename, void *ptr, int width, int height, <a class="el" href="group__imageFormat.html#ga931c48e08f361637d093355d64583406">imageFormat</a> format, int quality=95, const float2 &amp;pixel_range=<a class="el" href="cudaMath_8h.html#a931119b28bbeb119817cd0128f422a08">make_float2</a>(0, 255))</td></tr>
<tr class="memdesc:gadf4b35ed3583dbc77f2444f207de6008"><td class="mdescLeft">&#160;</td><td class="mdescRight">Save an image in CPU/GPU shared memory to disk.  <a href="#gadf4b35ed3583dbc77f2444f207de6008">More...</a><br /></td></tr>
<tr class="separator:gadf4b35ed3583dbc77f2444f207de6008"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga346b074e328e57539775110ab92bdd7e"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__image.html#ga346b074e328e57539775110ab92bdd7e">saveImageRGBA</a> (const char *filename, float4 *ptr, int width, int height, float max_pixel=255.0f, int quality=100)</td></tr>
<tr class="memdesc:ga346b074e328e57539775110ab92bdd7e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Save a float4 image in CPU/GPU shared memory to disk.  <a href="#ga346b074e328e57539775110ab92bdd7e">More...</a><br /></td></tr>
<tr class="separator:ga346b074e328e57539775110ab92bdd7e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Loading and saving image files from disk. </p>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga27eecc15662ad22366515de5cc054342"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga27eecc15662ad22366515de5cc054342">&#9670;&nbsp;</a></span>loadImage() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">bool loadImage </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">T **&#160;</td>
          <td class="paramname"><em>ptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>height</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Load a color image from disk into CUDA memory, in uchar3/uchar4/float3/float4 formats with pixel values 0-255. </p>
<p>Supported image file formats by <a class="el" href="group__image.html#ga27eecc15662ad22366515de5cc054342" title="Load a color image from disk into CUDA memory, in uchar3/uchar4/float3/float4 formats with pixel valu...">loadImage()</a> include:</p>
<ul>
<li>JPG</li>
<li>PNG</li>
<li>TGA</li>
<li>BMP</li>
<li>GIF</li>
<li>PSD</li>
<li>HDR</li>
<li>PIC</li>
<li>PNM (PPM/PGM binary)</li>
</ul>
<p>This function loads the image into shared CPU/GPU memory, using the functions from <a class="el" href="cudaMappedMemory_8h.html">cudaMappedMemory.h</a></p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">filename</td><td>Path to the image file to load from disk. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">ptr</td><td>Reference to pointer that will be set to the shared CPU/GPU buffer containing the image that will be allocated. This buffer will be allocated by <a class="el" href="group__image.html#ga27eecc15662ad22366515de5cc054342" title="Load a color image from disk into CUDA memory, in uchar3/uchar4/float3/float4 formats with pixel valu...">loadImage()</a> in CUDA mapped memory, so it is shared between CPU/GPU. gpu will be the pointer to this shared buffer in the GPU's address space. There is physically one buffer in memory. </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">width</td><td>Pointer to int variable that gets set to the width of the image in pixels. If the width variable contains a non-zero value when it's passed in, the image is resized to this desired width. Otherwise if the value of width is 0, the image will be loaded with it's dimensions from the file on disk. </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">height</td><td>Pointer to int variable that gets set to the height of the image in pixels. If the height variable contains a non-zero value when it's passed in, the image is resized to this desired height. Otherwise if the value of height is 0, the image will be loaded with it's dimensions from the file on disk. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga177a5b87ec9b79bfed324fcab2d3b8c1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga177a5b87ec9b79bfed324fcab2d3b8c1">&#9670;&nbsp;</a></span>loadImage() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool loadImage </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void **&#160;</td>
          <td class="paramname"><em>output</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>height</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__imageFormat.html#ga931c48e08f361637d093355d64583406">imageFormat</a>&#160;</td>
          <td class="paramname"><em>format</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Load a color image from disk into CUDA memory, in uchar3/uchar4/float3/float4 formats with pixel values 0-255. </p>
<p>Supported image file formats by <a class="el" href="group__image.html#ga27eecc15662ad22366515de5cc054342" title="Load a color image from disk into CUDA memory, in uchar3/uchar4/float3/float4 formats with pixel valu...">loadImage()</a> include:</p>
<ul>
<li>JPG</li>
<li>PNG</li>
<li>TGA</li>
<li>BMP</li>
<li>GIF</li>
<li>PSD</li>
<li>HDR</li>
<li>PIC</li>
<li>PNM (PPM/PGM binary)</li>
</ul>
<p>This function loads the image into shared CPU/GPU memory, using the functions from <a class="el" href="cudaMappedMemory_8h.html">cudaMappedMemory.h</a></p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">filename</td><td>Path to the image file to load from disk. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">ptr</td><td>Reference to pointer that will be set to the shared CPU/GPU buffer containing the image that will be allocated. This buffer will be allocated by <a class="el" href="group__image.html#ga27eecc15662ad22366515de5cc054342" title="Load a color image from disk into CUDA memory, in uchar3/uchar4/float3/float4 formats with pixel valu...">loadImage()</a> in CUDA mapped memory, so it is shared between CPU/GPU. gpu will be the pointer to this shared buffer in the GPU's address space. There is physically one buffer in memory. </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">width</td><td>Pointer to int variable that gets set to the width of the image in pixels. If the width variable contains a non-zero value when it's passed in, the image is resized to this desired width. Otherwise if the value of width is 0, the image will be loaded with it's dimensions from the file on disk. </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">height</td><td>Pointer to int variable that gets set to the height of the image in pixels. If the height variable contains a non-zero value when it's passed in, the image is resized to this desired height. Otherwise if the value of height is 0, the image will be loaded with it's dimensions from the file on disk. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gad9ee4cb1bfdf4efe01e2971b93118972"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad9ee4cb1bfdf4efe01e2971b93118972">&#9670;&nbsp;</a></span>loadImageRGBA() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool loadImageRGBA </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float4 **&#160;</td>
          <td class="paramname"><em>ptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>height</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Load a color image from disk into CUDA memory with alpha, in float4 RGBA format with pixel values 0-255. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__image.html#ga27eecc15662ad22366515de5cc054342" title="Load a color image from disk into CUDA memory, in uchar3/uchar4/float3/float4 formats with pixel valu...">loadImage()</a> for more details about parameters and supported <a class="el" href="group__image.html" title="Loading and saving image files from disk. ">Image I/O</a> formats. </dd></dl>
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000010">Deprecated:</a></b></dt><dd>this overload of <a class="el" href="group__image.html#gad9ee4cb1bfdf4efe01e2971b93118972" title="Load a color image from disk into CUDA memory with alpha, in float4 RGBA format with pixel values 0-2...">loadImageRGBA()</a> is deprecated and provided for legacy compatbility. it is recommended to use <a class="el" href="group__image.html#ga27eecc15662ad22366515de5cc054342" title="Load a color image from disk into CUDA memory, in uchar3/uchar4/float3/float4 formats with pixel valu...">loadImage()</a> instead, which supports multiple image formats.</dd></dl>

</div>
</div>
<a id="gac4fec7924987c98f8fbb40176e450e04"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac4fec7924987c98f8fbb40176e450e04">&#9670;&nbsp;</a></span>loadImageRGBA() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool loadImageRGBA </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float4 **&#160;</td>
          <td class="paramname"><em>cpu</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float4 **&#160;</td>
          <td class="paramname"><em>gpu</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>height</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Load a color image from disk into CUDA memory with alpha, in float4 RGBA format with pixel values 0-255. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__image.html#ga27eecc15662ad22366515de5cc054342" title="Load a color image from disk into CUDA memory, in uchar3/uchar4/float3/float4 formats with pixel valu...">loadImage()</a> for more details about parameters and supported <a class="el" href="group__image.html" title="Loading and saving image files from disk. ">Image I/O</a> formats. </dd></dl>
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000011">Deprecated:</a></b></dt><dd>this overload of <a class="el" href="group__image.html#gad9ee4cb1bfdf4efe01e2971b93118972" title="Load a color image from disk into CUDA memory with alpha, in float4 RGBA format with pixel values 0-2...">loadImageRGBA()</a> is deprecated and provided for legacy compatbility. having separate CPU and GPU pointers for shared memory is no longer needed, as they are the same. it is recommended to use <a class="el" href="group__image.html#ga27eecc15662ad22366515de5cc054342" title="Load a color image from disk into CUDA memory, in uchar3/uchar4/float3/float4 formats with pixel valu...">loadImage()</a> instead, which supports multiple image formats.</dd></dl>

</div>
</div>
<a id="ga54f40bb94c9d78d639a20e5ac1e21669"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga54f40bb94c9d78d639a20e5ac1e21669">&#9670;&nbsp;</a></span>saveImage() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">bool saveImage </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">T *&#160;</td>
          <td class="paramname"><em>ptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>height</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>quality</em> = <code>95</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const float2 &amp;&#160;</td>
          <td class="paramname"><em>pixel_range</em> = <code><a class="el" href="cudaMath_8h.html#a931119b28bbeb119817cd0128f422a08">make_float2</a>(0,255)</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Save an image in CPU/GPU shared memory to disk. </p>
<p>Supported image file formats by <a class="el" href="group__image.html#ga54f40bb94c9d78d639a20e5ac1e21669" title="Save an image in CPU/GPU shared memory to disk. ">saveImage()</a> include:</p>
<ul>
<li>JPG</li>
<li>PNG</li>
<li>TGA</li>
<li>BMP</li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">filename</td><td>Desired path of the image file to save to disk. </td></tr>
    <tr><td class="paramname">ptr</td><td>Pointer to the buffer containing the image in shared CPU/GPU zero-copy memory. </td></tr>
    <tr><td class="paramname">width</td><td>Width of the image in pixels. </td></tr>
    <tr><td class="paramname">height</td><td>Height of the image in pixels. </td></tr>
    <tr><td class="paramname">max_pixel</td><td>The maximum pixel value of this image, by default it's 255 for images in the range of 0-255. If your image is in the range of 0-1, pass 1.0 as this value. Then the pixel values of the image will be rescaled appropriately to be stored on disk (which expects a range of 0-255). </td></tr>
    <tr><td class="paramname">quality</td><td>Indicates the compression quality level (between 1 and 100) to be applied for JPEG and PNG images. A level of 1 correponds to reduced quality and maximum compression. A level of 100 corresponds to maximum quality and reduced compression. By default a level of 95 is used for high quality and moderate compression. Note that this quality parameter only applies to JPEG and PNG, other formats will ignore it. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gadf4b35ed3583dbc77f2444f207de6008"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gadf4b35ed3583dbc77f2444f207de6008">&#9670;&nbsp;</a></span>saveImage() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool saveImage </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>ptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>height</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__imageFormat.html#ga931c48e08f361637d093355d64583406">imageFormat</a>&#160;</td>
          <td class="paramname"><em>format</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>quality</em> = <code>95</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const float2 &amp;&#160;</td>
          <td class="paramname"><em>pixel_range</em> = <code><a class="el" href="cudaMath_8h.html#a931119b28bbeb119817cd0128f422a08">make_float2</a>(0,&#160;255)</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Save an image in CPU/GPU shared memory to disk. </p>
<p>Supported image file formats by <a class="el" href="group__image.html#ga54f40bb94c9d78d639a20e5ac1e21669" title="Save an image in CPU/GPU shared memory to disk. ">saveImage()</a> include:</p>
<ul>
<li>JPG</li>
<li>PNG</li>
<li>TGA</li>
<li>BMP</li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">filename</td><td>Desired path of the image file to save to disk. </td></tr>
    <tr><td class="paramname">ptr</td><td>Pointer to the buffer containing the image in shared CPU/GPU zero-copy memory. </td></tr>
    <tr><td class="paramname">width</td><td>Width of the image in pixels. </td></tr>
    <tr><td class="paramname">height</td><td>Height of the image in pixels. </td></tr>
    <tr><td class="paramname">max_pixel</td><td>The maximum pixel value of this image, by default it's 255 for images in the range of 0-255. If your image is in the range of 0-1, pass 1.0 as this value. Then the pixel values of the image will be rescaled appropriately to be stored on disk (which expects a range of 0-255). </td></tr>
    <tr><td class="paramname">quality</td><td>Indicates the compression quality level (between 1 and 100) to be applied for JPEG and PNG images. A level of 1 correponds to reduced quality and maximum compression. A level of 100 corresponds to maximum quality and reduced compression. By default a level of 95 is used for high quality and moderate compression. Note that this quality parameter only applies to JPEG and PNG, other formats will ignore it. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga346b074e328e57539775110ab92bdd7e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga346b074e328e57539775110ab92bdd7e">&#9670;&nbsp;</a></span>saveImageRGBA()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool saveImageRGBA </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float4 *&#160;</td>
          <td class="paramname"><em>ptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>height</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>max_pixel</em> = <code>255.0f</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>quality</em> = <code>100</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Save a float4 image in CPU/GPU shared memory to disk. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__image.html#ga54f40bb94c9d78d639a20e5ac1e21669" title="Save an image in CPU/GPU shared memory to disk. ">saveImage()</a> for more details about parameters and supported <a class="el" href="group__image.html" title="Loading and saving image files from disk. ">Image I/O</a> formats. </dd></dl>
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000012">Deprecated:</a></b></dt><dd><a class="el" href="group__image.html#ga346b074e328e57539775110ab92bdd7e" title="Save a float4 image in CPU/GPU shared memory to disk. ">saveImageRGBA()</a> is deprecated and provided for legacy compatbility. it is recommended to use <a class="el" href="group__image.html#ga54f40bb94c9d78d639a20e5ac1e21669" title="Save an image in CPU/GPU shared memory to disk. ">saveImage()</a> instead, which supports multiple image formats.</dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Tue Jul 14 2020 21:59:34 for Jetson Inference by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
